// pages/page1/page1.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    winWidth: 0,
    winHeight: 0,
    currentTab: 0,
    indicatordots: true,/*加入图标指示点*/
    autoplay: true,/*自动切换图片开关*/
    interval: 3000,   /*切换时间属性1000=1秒*/
    imglist:[
      {
        "imgsrc":"../../images/page2.png",
        "min":12,
        "text":"八成新，闲置中，低价出租"
      },
      {
        "imgsrc":"../../images/page1.png",
        "min":13,
        "text":"八成新，闲置中，低价出租"
      },
      {
        "imgsrc":"../../images/page2.png",
        "min":12,
        "text":"八成新，闲置中，低价出租"
      },
      {
        "imgsrc":"../../images/page1.png",
        "min":13,
        "text":"八成新，闲置中，低价出租"
      },
      {
        "imgsrc":"../../images/page2.png",
        "min":12,
        "text":"八成新，闲置中，低价出租"
      },
      {
        "imgsrc":"../../images/page1.png",
        "min":13,
        "text":"八成新，闲置中，低价出租"
      },
      {
        "imgsrc":"../../images/page2.png",
        "min":12,
        "text":"八成新，闲置中，低价出租"
      },
      {
        "imgsrc":"../../images/page1.png",
        "min":13,
        "text":"八成新，闲置中，低价出租"
      },
      {
        "imgsrc":"../../images/page2.png",
        "min":12,
        "text":"八成新，闲置中，低价出租"
      },
      {
        "imgsrc":"../../images/page1.png",
        "min":13,
        "text":"八成新，闲置中，低价出租"
      },
      {
        "imgsrc":"../../images/page2.png",
        "min":12,
        "text":"八成新，闲置中，低价出租"
      },
      {
        "imgsrc":"../../images/page1.png",
        "min":13,
        "text":"八成新，闲置中，低价出租"
      },
    ],
    newimglist:[
      {
        "imgsrc":"../../images/page2.png",
        "money":120,
        "text":"八成新，用过几次，想换钱换个新的！"
      },
      {
        "imgsrc":"../../images/page1.png",
        "money":130,
        "text":"九成九新，只用过一次，含泪甩出！"
      },
      {
        "imgsrc":"../../images/page2.png",
        "money":120,
        "text":"八成新，用过几次，想换钱换个新的！"
      },
      {
        "imgsrc":"../../images/page1.png",
        "money":130,
        "text":"九成九新，只用过一次，含泪甩出！"
      },
      {
        "imgsrc":"../../images/page2.png",
        "money":120,
        "text":"八成新，用过几次，想换钱换个新的！"
      },
      {
        "imgsrc":"../../images/page1.png",
        "money":130,
        "text":"九成九新，只用过一次，含泪甩出！"
      },
      {
        "imgsrc":"../../images/page2.png",
        "money":120,
        "text":"八成新，用过几次，想换钱换个新的！"
      },
      {
        "imgsrc":"../../images/page1.png",
        "money":130,
        "text":"九成九新，只用过一次，含泪甩出！"
      },
      {
        "imgsrc":"../../images/page2.png",
        "money":120,
        "text":"八成新，用过几次，想换钱换个新的！"
      },
      {
        "imgsrc":"../../images/page1.png",
        "money":130,
        "text":"九成九新，只用过一次，含泪甩出！"
      }
    ]


    
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady:function() {
    var that = this;
    wx.getSystemInfo({
      success: (result) => {
        that.setData({
          winWidth:result.windowWidth,
          winHeight:result.windowHeight
        });
      },
    });
  },

  bindChange:function(e){
    var that = this;
    that.setData({
      currentTab: e.detail.current
    });
  },
  bindClick1:function(e){
    var that = this;
    wx.navigateTo({
      url: '../page2/pages2?imgsrc='+that.data.imglist[0].imgsrc+'&money'+that.data.imglist[0].min+'&text='+that.data.imglist[0].text+'&type=租赁',
    })
  },
  bindClick2:function(e){
    var that = this;
    wx.navigateTo({
      url: '../page2/pages2?imgsrc='+that.data.newimglist[1].imgsrc+'&money'+that.data.newimglist[1].money+'&text='+that.data.newimglist[1].text+'&type=购买',
    })
  },

  swichNav: function(e) {
    var that = this;
    if (this.data.currentTab === e.target.dataset.current) {
      return false;
    } else {
      that.setData({
        currentTab: e.target.dataset.current
      })
    }
  },
  topage: function(e){
    this.setData({
      currentTab:3,
    })
  },
  gopage: function(e){
    this.setData({
      currentTab:2,
    })
  },

  /**
   * 生命周期函数--监听页面显示
   */
 
onShow: function () {
  if (typeof this.getTabBar === 'function' &&
  this.getTabBar()) {
  this.getTabBar().setData({
    selected: null  //标亮的导航按钮的下标，如果是其他子页面，可以赋值为null
  })
}
},

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  },

  
})